package com.example.common.domain.pojo.Deserialize;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;

// 自定义反序列化器示例
public class MapToStringDeserializer extends JsonDeserializer<String> {
    private static final ObjectMapper objectMapper = new ObjectMapper();

    @Override
    public String deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
        Object options = objectMapper.readValue(p, Object.class);
        return objectMapper.writeValueAsString(options);
    }
}
